using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace XnaDevRu.BulletX
{

    /// <summary>
    /// CastResult stores the closest result
    /// alternatively, add a callback method to decide about closest/all results
    /// </summary>
	public class CastResult
	{
		private Vector3 _normal;
		private float _fraction;
		private Matrix _hitTransformA;
		private Matrix _hitTransformB;
		private IDebugDraw _debugDrawer;

		public CastResult()
		{
			_fraction = 1e30f;
		}

		public Vector3 Normal { get { return _normal; } set { _normal = value; } }
		public float Fraction { get { return _fraction; } set { _fraction = value; } }
		public Matrix HitTransformA { get { return _hitTransformA; } set { _hitTransformA = value; } }
		public Matrix HitTransformB { get { return _hitTransformB; } set { _hitTransformB = value; } }
		public IDebugDraw DebugDrawer { get { return _debugDrawer; } set { _debugDrawer = value; } }

		public virtual void DebugDraw(float fraction) { }
		public virtual void DrawCoordSystem(Matrix trans) { }
	}

	/// <summary>
    /// ConvexCast is an interface for Casting
	/// </summary>
	public interface IConvexCast
	{
		/// <summary>
        /// cast a convex against another convex object
		/// </summary>
		/// <param name="fromA"></param>
		/// <param name="toA"></param>
		/// <param name="fromB"></param>
		/// <param name="toB"></param>
		/// <param name="result"></param>
		/// <returns></returns>
		bool CalcTimeOfImpact(Matrix fromA, Matrix toA, Matrix fromB, Matrix toB, CastResult result);
	}
}
